/**
 * 患者管理  搜索显示患者
 */
<template>
  <div>
    
    <!--列表-->
    <el-table
      size="small"
      :data="listData"
      highlight-current-row
      v-loading="loading"
      border
      element-loading-text="拼命加载中"
      style="width: 100%"
    >
      <el-table-column
        prop="id"
        label="患者ID"
        width="120"
        show-overflow-tooltip
        align="center"
      >
      </el-table-column>
      <el-table-column
        prop="idcard"
        label="患者卡号"
        width="300"
        show-overflow-tooltip
        align="center"
      >
      </el-table-column>
      <el-table-column
        prop="name"
        label="患者姓名"
        width="150"
        show-overflow-tooltip
        align="center"
      >
      </el-table-column>
      <el-table-column
        prop="sex"
        label="性别"
        width="100"
        show-overflow-tooltip
        align="center"
      >
      </el-table-column>
      <el-table-column
        prop="age"
        label="年龄"
        width="100"
        show-overflow-tooltip
        align="center"
      >
      </el-table-column>
      <el-table-column
        prop="phoneNumber"
        label="手机号码"
        width="250"
        show-overflow-tooltip
        align="center"
      >
      </el-table-column>
      <el-table-column
        prop="createTime"
        label="创建时间"
        min-width="180"
        show-overflow-tooltip
        align="center"
      >
      </el-table-column>
      
    </el-table>
    <!-- 分页组件 -->

   
  </div>
</template>

<script>
import axios from "axios";
import Pagination from "../../components/Pagination";
import { regionData,CodeToText,TextToCode} from 'element-china-area-data';
export default {
  data() {
    return {

        //地址三级联动
        options: regionData,
      listData: [],

      //时间段选择
      pickerOptions: {
        shortcuts: [
          {
            text: "最近一周",
            onClick(picker) {
              const end = new Date();
              const start = new Date();
              start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
              picker.$emit("pick", [start, end]);
            },
          },
          {
            text: "最近一个月",
            onClick(picker) {
              const end = new Date();
              const start = new Date();
              start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
              picker.$emit("pick", [start, end]);
            },
          },
          {
            text: "最近三个月",
            onClick(picker) {
              const end = new Date();
              const start = new Date();
              start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
              picker.$emit("pick", [start, end]);
            },
          },
        ],
      },
      value1: [new Date(2000, 10, 10, 10, 10), new Date(2000, 10, 11, 10, 10)],
      value2: "",

      //查询后端数据存放的地方
      patient: {
        nameOrPhone: "",
        createTimeFront: "",
        createTimeBack: "",
        pageNum: "",
        pageSize:""
      },

      loading: false, //是显示加载
      editFormVisible: false, //控制编辑页面显示与隐藏
      title: "添加",
      sex:[
        {key: "男", value: "男" },
        {key: "女", value:"女" },

      ],
      source:[
        {key: "朋友介绍", value: "朋友介绍" },
        {key: "线上预约", value:"线上预约" },
        {key: "线下上门", value:"线下上门" }
      ],
      maritalStatus:[
        {key: "未婚", value: "未婚" },
        {key: "已婚", value:"已婚" },
        {key: "未知", value:"未知" },
      ],
      education:[
        {key: "博士", value: "博士" },
        {key: "硕士", value:"硕士" },
        {key: "本科", value: "本科" },
        {key: "大专", value:"大专" },
        {key: "高中及以下", value:"高中及以下" },
      ],
      occupation:[
        {key: "军人", value: "军人" },
        {key: "学生", value:"学生" },
        {key: "教师", value: "教师" },
        {key: "医生", value:"医生" },
        {key: "工人", value:"工人" },
        {key: "商人", value:"商人" },
        {key: "司机", value:"司机" },
        {key: "公务员", value:"公务员" },
        {key: "其他", value:"其他" },
      ],
      nation:[
        {key: "汉族", value: "汉族" },
        {key: "蒙古族", value:"蒙古族" },
        {key: "回族", value: "回族" },
        {key: "藏族", value:"藏族" },
        {key: "维吾尔族", value:"维吾尔族" },
        {key: "苗族", value:"苗族" },
        {key: "彝族", value:"彝族" },
        {key: "壮族", value:"壮族" },
        {key: "布依族", value:"布依族" },
        {key: "朝鲜族", value:"朝鲜族" },
        {key: "满族", value:"满族" },
        {key: "侗族", value:"侗族" },
        {key: "瑶族", value:"瑶族" },
        {key: "白族", value:"白族" },
        {key: "土家族", value:"土家族" },
        {key: "高山族", value:"高山族" },
        {key: "其他民族", value:"其他民族" },
      ],
      editForm: {
        id:"",
        name: "",
        idcard: "",
        age: "",
        birthday: "",
        sex: "",
        phoneNumber: "",
        address:"",
        myAddress:[],
        detailAddress:"",
        source: "",
        nation: "",
        maritalStatus: "",
        education: "",
        occupation: "",
        workPlace: "",
        mark:"",
        token: localStorage.getItem("logintoken"),
      },
     
    };
  },
  
  /**
   * 创建完毕
   */
  created() {
    this.getpatientlist();
  },

  /**
   * 里面的方法只有被调用才会执行
   */
  methods: {
   
    getpatientlist() {
      
      this.patient.id=this.$route.query.patientId;
      axios.post("/api/patient/selectOneById?id="+this.$route.query.patientId).then((res) => {
        this.loading = false;
        console.log("后端来的",res)
        this.listData = [res.data.data];
  
     
        
      });
    }
    
  }
};
</script>

<style scoped>
.user-search {
  margin-top: 20px;
}
.userRole {
  width: 100%;
}
</style>

 
 